/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package PP3.Datos;

import java.sql.*;
import javax.swing.JOptionPane;
/**
 *
 * @author GROVER
 */
public class Datos_Sql {
protected Connection cn;
    protected Statement st; 
    Connection com=null;
    
    public Datos_Sql()throws SQLException{
        String url="";
        try{
            Class.forName("oracle.jdbc.driver.OracleDriver");
            this.cn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","upds2014");
        }catch(Exception e){
            System.out.println(e.getMessage());
            JOptionPane.showMessageDialog(null, e);
        }
    } 
    public ResultSet seleccionar(String srtcad)throws SQLException{
        this.st=this.cn.createStatement();
        return st.executeQuery(srtcad);
    }
    public boolean ejecutar(String strsql) throws SQLException{
        this.st=this.cn.createStatement();
        return(this.st.executeUpdate(strsql)>0);
    }
       
}
